package com.szqhyxj.youxiangju.sys;

import com.google.gson.annotations.SerializedName;

public class BaseResult<T> {

    @SerializedName("retCode")
    private String code;

    @SerializedName("retMsg")
    private String message;

    @SerializedName("data")
    private T data;

    public BaseResult(String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    private static final String BUSINESS_LOGIC_SUCCESS = "0000";

    private static final String BUSINESS_LOGIC_FAIL = "0001";

    private static final String TOKEN_NO_AVAILABLE = "0002";

    public boolean businessLogicFail() {
        return this.code.equals(BUSINESS_LOGIC_FAIL);
    }

    public boolean businessLogicSuccess() {
        return this.code.equals(BUSINESS_LOGIC_SUCCESS);
    }

    public boolean tokenNoAvailable() {
        return this.code.equals(TOKEN_NO_AVAILABLE);
    }
}